package com.lyun.controller;

import com.lyun.common.R;
import com.lyun.dto.AdminAbledUserDTO;
import com.lyun.dto.AdminUserDTO;
import com.lyun.service.UserService;
import com.lyun.vo.AdminUserVO;
import com.lyun.vo.PageVO;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/admin/user")
@CrossOrigin
public class AdminUserController {

    @DubboReference
    private UserService userService;

    /**
     * 管理端-获取用户列表
     *
     * @return
     */
    @GetMapping("/getAll")
    public R<PageVO<AdminUserVO>> adminGetAll(AdminUserDTO dto) {
        return R.success(userService.adminGetAll(dto));
    }

    /**
     * 管理端-禁用/启用用户
     *
     * @return
     */
    @RequestMapping("/abled")
    public R<String> abledUser(AdminAbledUserDTO dto) {
        userService.auditSmallVideo(dto);
        return R.success("操作成功");
    }
}
